package com.example.service;

import cn.dev33.satoken.stp.StpInterface;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * 业务聚合
 *
 * @version [V2.0]
 * @package com.example.service;
 * @description:[用一句话描述该文件做什么]
 * @author: [zhuben]
 * @date: [2024-01-25 14:16]
 * @copyright: 2024 echovin.com
 */
@Component
public class StpInterfaceImpl implements StpInterface {
    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        Map<String, List<String>> permissionMap = new HashMap<>();
        permissionMap.put("admin", Arrays.asList("*"));
        permissionMap.put("0001", Arrays.asList("/user/list","/user/add"));
        permissionMap.put("0002", Arrays.asList("/orders/list"));
        return permissionMap.get(loginId);
    }

    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
        Map<String, List<String>> roleMap = new HashMap<>();
        roleMap.put("admin", Arrays.asList("admin"));
        roleMap.put("0001", Arrays.asList("user"));
        roleMap.put("0002", Arrays.asList("orders"));
        return roleMap.get(loginId);
    }
}
